from bot_body import Bot_body
import plugins
from plugins.bot_plugin import Bot_plugin
from plugins.together_secs_count.together_secs_count import Plugin_together_secs_count
from plugins.test_plugin.test_plugin import Plugin_test
from plugins.authorize_plugin.authorize_plugin import Group_manager
from plugins.authorize_plugin.authorize_plugin import Plugin_suffix_manager
from plugins.authorize_plugin.authorize_plugin import Plugin_authorize
from plugins.snap_plugin.snap_plugin import Plugin_snap
from plugins.nick_plugin.nick_plugin import Plugin_nick
from plugins.bridge_plugin.bridge_plugin import Plugin_bridge_manager
from plugins.bridge_plugin.bridge_plugin import Plugin_bridge
from plugins.protect_plugin.protect_plugin import Plugin_protect
from plugins.invite_plugin.invite_plugin import Plugin_invite

import logging


if __name__ == '__main__':
    logging.basicConfig(level = logging.DEBUG,
        format="[TIME:%(asctime)s][FILE:%(filename)s][LINENO:%(lineno)d] %(message)s")
    bot_body = Bot_body(
        master_qqs={892132762,1215002199},
        report_qq = 892132762,
        api_root='http://localhost:26102',
        access_token="1691258078",
        secret='hijklmn',
        host='localhost',
        port=26103,
        version='1.5',
        version_scription="局部后缀无法覆盖全局后缀"
    )
    # echo_plugin = Bot_plugin(bot_body)
    # echo_plugin.register()
    together_time_plugin = Plugin_together_secs_count(bot_body)
    together_time_plugin.register()
    # test_plugin = Plugin_test(bot_body)
    # test_plugin.register()
    group_manager = Group_manager()
    authorize_plugin = Plugin_authorize(bot_body, group_manager=group_manager)
    authorize_plugin.register()
    suffix_plugin = Plugin_suffix_manager(bot_body, group_manager=group_manager)
    suffix_plugin.register()
    snap_plugin = Plugin_snap(bot_body=bot_body, authorizer=authorize_plugin, suffix_manager=suffix_plugin)
    snap_plugin.register()
    
    nick_plugin = Plugin_nick(bot_body=bot_body)
    nick_plugin.register()
    bridge_manager_plugin = Plugin_bridge_manager(bot_body=bot_body)
    bridge_manager_plugin.register()
    bridge_plugin = Plugin_bridge(bot_body=bot_body, bridge_manager=bridge_manager_plugin, nick_manager=nick_plugin)
    bridge_plugin.register()
    
    protect_plugin = Plugin_protect(bot_body=bot_body)
    protect_plugin.register_all()
    invite_plugin = Plugin_invite(bot_body=bot_body)
    invite_plugin.register_all()
    
    
    bot_body.run()
    